package com.service.impl;

import com.entity.Admin;
import com.dao.Admindao;
import com.impl.AdmindaoImpl;

public class AdminserviceImpl implements Adminservice
{
	private Admindao admindao=new AdmindaoImpl();
	public boolean login(Admin admin) 
	{
		boolean result =false;
		Admin realadmin =admindao.selectbyAdmin(admin.getUsername());
		if(realadmin!=null)
		{
			if(realadmin.getPassword().equals(admin.getPassword()))
			{
				result=true;
			}
		
		}
		return result;
	}
	public int reg(Admin admin)
	{
		int result=0;

		Admin realadmin =admindao.selectbyAdmin(admin.getUsername());
		if(realadmin==null)
		{
			result=admindao.insertAdmin(admin);
		}
		else
		{
			result=-1;
		}
		return result;
		
	}
}
	
